﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Reflection;

using FundSms.SmsLib;

namespace FundSms.Client.DALFactory
{
    public sealed class DataAccess
    {
        // Look up the DAL implementation we should be using
        private static readonly string path = ConfigurationManager.AppSettings["ClientDAL"];

        private DataAccess()
        {
        }

        public static FundSms.Client.IDAL.ISmsMO CreateMO()
        {
            string className = path + ".SmsMO";
            return (FundSms.Client.IDAL.ISmsMO)Assembly.Load(path).CreateInstance(className);
        }

        public static FundSms.Client.IDAL.ISmsReturn CreateSmsReturn()
        {
            string className = path + ".SmsReturn";
            return (FundSms.Client.IDAL.ISmsReturn)Assembly.Load(path).CreateInstance(className);
        }

        public static FundSms.Client.IDAL.ISmsSendList CreateSmsSendList()
        {
            string className = path + ".SmsSendList";
            return (FundSms.Client.IDAL.ISmsSendList)Assembly.Load(path).CreateInstance(className);
        }

        public static FundSms.Client.IDAL.ISmsSendLog CreateSmsSendLog()
        {
            string className = path + ".SmsSendLog";
            return (FundSms.Client.IDAL.ISmsSendLog)Assembly.Load(path).CreateInstance(className);
        }

    }
}
